using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using SMO.Models.SimplObject;

namespace SMO.Controllers
{
    public class MarketStatisticsController : Controller
    {
        StockRepository stockRepository;


        public MarketStatisticsController()
        {
            stockRepository = new StockRepository();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ViewResult TableOfStockPrice(FormCollection formValues)
        {
            string id = formValues.Get("ctl00$MainContent$DropDownList1");
            var allStockByTypeSTC = from i in stockRepository.GetAll()
                                    where (i.TypeSTC.Value.ToString() == id)
                                    orderby i.StockSymbol ascending
                                    select i;
            return View(allStockByTypeSTC.ToList());
        }


        public ActionResult TableOfStockPrice()
        {
            var allStockByTypeSTC = from i in stockRepository.GetAll()
                                    where (i.TypeSTC.ToString() == "1")

                                    select i;
            return View(allStockByTypeSTC.ToList());
        }

    }
}
